package edu.java.texbooks.scjp.threads.test13;

public class Consumer implements Runnable {

	private static final int AMOUNT = 10;
	private String name = "";
	Account account = null;

	public Consumer(Account account, String name) {
		this.account = account;
		this.name = name;
	}

	@Override
	public void run() {
		while (account.getBalance() >= AMOUNT) {
			account.withdraw(AMOUNT);
			System.out.println(name
					+ ": Withdraw operation succeeds. Current balance: "
					+ account.getBalance());
		}

	}

}
